package Link;

public class leet_offer_22 {
}

class Solution_offer_22 {
    public ListNode getKthFromEnd(ListNode head, int k) {
        return null;
    }

    public ListNode getKNode(ListNode head, int k){
        if(head==null){
            return head;
        }
        while(head!=null){
            ListNode tmpNode = head;
            int tmpK = k;
            while(tmpNode!=null && tmpK>0){
                tmpNode= tmpNode.next;
                tmpK--;
            }
            if(tmpNode == null && tmpK==0){
                return head;
            }else {
                head = head.next;
            }
        }
        return null;
    }

}